home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / include / rtp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-27  |  7.1 KB  |  238 lines

  1. /*
  2.  * rtp.h
  3.  *
  4.  * Constants and structures based on the 12/15/92 draft of the RTP protocol
  5.  * Internet Draft. This information is still subject to change.
  6.  *
  7.  */
  8.  
  9. #ifndef _rtp_h
  10. #define _rtp_h
  11.  
  12. #define RTP_VERSION    1
  13.  
  14. #define RTP_RETRANS    1
  15. #define RTP_REFILL    (1<<1)
  16. #define RTP_LOCALBUF    (1<<2)
  17. #define    RTP_NOINPOLA    (1<<3)
  18. #define    RTP_SLOWVIDEO    (1<<4)    /* almost 30% slower, but may have higher Q */
  19. #define    RTP_OVERIP    (1<<5)
  20. #define    RTP_OVERTCP    (1<<6)
  21. #define    RTP_NO_DEF    (1<<7)    /* otherwise, use UDP    */
  22.  
  23. #define    RTP_OPT_UDELAY    1
  24. #define    RTP_OPT_HDRLEN    2
  25. #define    RTP_OPT_GROUPID    3
  26. #define    RTP_OPT_ADDFLAG    4
  27. #define    RTP_OPT_FLAGS    5
  28. #define    RTP_OPT_QOS    6
  29.  
  30. /* Offset from UNIX's epoch to the NTP epoch in seconds (NTP's JAN_1970) */
  31. #define RTP_EPOCH_OFFSET    2208988800
  32.  
  33. /* Basic RTP header */
  34. typedef    struct    rtphdr {
  35. #ifndef LITTLE_BITFIELDS
  36.     byte    rh_vers:2;    /* version */
  37.     byte    rh_flow:6;    /* flow id */
  38.     byte    rh_opts:1;    /* options present */
  39.     byte    rh_sync:1;    /* end of synchronization unit */
  40.     byte    rh_content:6;    /* content id */
  41. #else
  42.     byte    rh_flow:6;    /* flow id */
  43.     byte    rh_vers:2;    /* version */
  44.     byte    rh_content:6;    /* content id */
  45.     byte    rh_sync:1;    /* end of synchronization unit */
  46.     byte    rh_opts:1;    /* options present */
  47. #endif
  48.     u_short    rh_seq;        /* sequence number */
  49.     longword rh_ts;        /* time stamp (middle of NTP timestamp) */
  50. } rtphdr_t;
  51.  
  52. /* Basic RTP option header */
  53. typedef    struct    rtpopthdr {
  54. #ifndef LITTLE_BITFIELDS
  55.     byte    roh_fin:1;    /* final option flag */
  56.     byte    roh_type:7;    /* option type */
  57. #else
  58.     byte    roh_type:7;    /* option type */
  59.     byte    roh_fin:1;    /* final option flag */
  60. #endif
  61.     byte    roh_optlen;    /* option len */
  62. } rtpopthdr_t;
  63.  
  64. /* Normal RTP options */
  65. #define RTPOPT_CSRC    0    /* Content source */
  66. #define RTPOPT_SSRC    1    /* Synchronization source */
  67. #define RTPOPT_BOP    2    /* Beginning of playout unit */
  68.  
  69. /* RTP source (CSRC, SSRC) option header */
  70. typedef    struct    rtpsrchdr {
  71. #ifndef LITTLE_BITFIELDS
  72.     byte    rsh_fin:1;    /* final option flag */
  73.     byte    rsh_type:7;    /* option type */
  74. #else
  75.     byte    rsh_type:7;    /* option type */
  76.     byte    rsh_fin:1;    /* final option flag */
  77. #endif
  78.     byte    rsh_optlen;    /* option len (== 2) */
  79.     u_short    rsh_uid;    /* unique id within host */
  80.     longword rsh_addr;    /* IP address of host */
  81. } rtpsrchdr_t;
  82.  
  83. /* RTP BOP option header */
  84. typedef    struct rtpbophdr    {
  85. #ifndef LITTLE_BITFIELDS
  86.     byte    rbh_fin:1;    /* final option flag */
  87.     byte    rbh_type:7;    /* option type */
  88. #else
  89.     byte    rbh_type:7;    /* option type */
  90.     byte    rbh_fin:1;    /* final option flag */
  91. #endif
  92.     byte    rbh_optlen;    /* option len (== 1) */
  93.     u_short    rbh_seq;    /* sequence number of BOP */
  94. } rtpbophdr_t;
  95.  
  96. /* RTCP forward direction options */
  97. #define RTPOPT_CDES    32    /* Content description */
  98. #define RTPOPT_SDES    33    /* Source description */
  99. #define RTPOPT_FDES    34    /* Flow description */
  100. #define RTPOPT_BYE    35    /* Conference exit notification */
  101.  
  102. /* RTCP CDESC option header */
  103. typedef    struct    rtcpcdeschdr {
  104. #ifndef LITTLE_BITFIELDS
  105.     byte    rtch_fin:1;    /* final option flag */
  106.     byte    rtch_type:7;    /* option type */
  107. #else
  108.     byte    rtch_type:7;    /* option type */
  109.     byte    rtch_fin:1;    /* final option flag */
  110. #endif
  111.     byte    rtch_optlen;    /* option len */
  112. #ifndef LITTLE_BITFIELDS
  113.     byte    rtch_x1:2;    /* reserved (must be 0) */
  114.     byte    rtch_content:6;    /* content id */
  115. #else
  116.     byte    rtch_content:6;    /* content id */
  117.     byte    rtch_x1:2;    /* reserved (must be 0) */
  118. #endif
  119.     byte    rtch_x2;    /* reserved (must be 0) */
  120.     u_short    rtch_rport;    /* return port */
  121.     byte    rtch_cqual;    /* clock quality */
  122.     byte    rtch_x3;    /* reserved (must be 0) */
  123.     longword rtch_cdesc;    /* content descriptor */
  124. } rtcpcdeschdr_t;
  125.  
  126. /* RTCP SDESC option header */
  127. typedef    struct    rtcpsdeschdr {
  128. #ifndef LITTLE_BITFIELDS
  129.     byte    rtsh_fin:1;    /* final option flag */
  130.     byte    rtsh_type:7;    /* option type */
  131. #else
  132.     byte    rtsh_type:7;    /* option type */
  133.     byte    rtsh_fin:1;    /* final option flag */
  134. #endif
  135.     byte    rtsh_optlen;    /* total option len    */
  136.     u_short    rtsh_uid;    /* unique id within host */
  137.     u_short    rtsh_class;        /* option class    */
  138.     byte    rtsh_msglen;    /* user option length    */
  139.     byte    data;        /* uses its address    */
  140. } rtcpsdeschdr_t;
  141.  
  142. /* RTCP BYE option header */
  143. typedef    struct    rtcpbyehdr {
  144. #ifndef LITTLE_BITFIELDS
  145.     byte    rtbh_fin:1;    /* final option flag */
  146.     byte    rtbh_type:7;    /* option type */
  147. #else
  148.     byte    rtbh_type:7;    /* option type */
  149.     byte    rtbh_fin:1;    /* final option flag */
  150. #endif
  151.     byte    rtbh_optlen;    /* option len */
  152.     u_short    rtbh_uid;    /* unique id within host */
  153.     longword rtbh_addr;    /* IP address of host */
  154. } rtcpbyehdr_t;
  155.  
  156. /* RTCP reverse direction options */
  157. #define RTPOPT_QOS    64    /* Quality of service */
  158. #define RTPOPT_RAD    65    /* Raw application data */
  159.  
  160. /* Basic RTCP reverse packet header */
  161. typedef    struct    rtcprevhdr {
  162.     byte    rtrh_flow;    /* flow id */
  163.     byte    rtrh_x1;    /* reserved (must be 0) */
  164.     byte    rtrh_x2;    /* reserved (must be 0) */
  165.     byte    rtrh_x3;    /* reserved (must be 0) */
  166. } rtcprevhdr_t;
  167.  
  168. /* RTCP QOS option header */
  169. typedef    struct    rtcpqoshdr {
  170. #ifndef LITTLE_BITFIELDS
  171.     byte    rtqh_fin:1;    /* final option flag */
  172.     byte    rtqh_type:7;    /* option type */
  173. #else
  174.     byte    rtqh_type:7;    /* option type */
  175.     byte    rtqh_fin:1;    /* final option flag */
  176. #endif
  177.     byte    rtqh_optlen;    /* option len (== 5) */
  178.     u_short    rtqh_uid;    /* unique id within host */
  179.     longword rtqh_addr;    /* IP address of host */
  180.     u_short    rtqh_precv;    /* packets received */
  181.     u_short    rtqh_seqrange;    /* sequence number range */
  182.     u_short    rtqh_mindel;    /* minimum delay */
  183.     u_short    rtqh_maxdel;    /* maximum delay */
  184.     u_short    rtqh_avgdel;    /* average delay */
  185.     u_short    rtqh_x;        /* reserved (must be 0) */
  186. } rtcpqoshdr_t;
  187.  
  188. /* LBL MOVIE & TEST    */
  189. typedef    struct    rtcp_movie    {
  190.     u_short    group_id;    /* frame ID    */
  191.     short    size;        /* window size    */
  192.     byte    fragment;    /* number of fragments in this group (frame) */
  193. #ifndef LITTLE_BITFIELDS
  194.     byte    fin_p:1;    /* final packet; assemble now    */
  195.     byte    ttl:7;        /* time to live; max is 128 ms.    */
  196. #else
  197.     byte    ttl:7;
  198.     byte    fin_p:1;
  199. #endif
  200.     u_short    linewidth;    /* image (scan line) width    */
  201.     byte    type;    /* protocol. can be used for extended header    */
  202.     /*    number bytes for more options that follows this header    */
  203.  
  204.     byte    pkt_id;        /* fragment (packet) ID    */
  205.     short    command;    /* reserved;    */
  206.     union    {
  207.         struct    {
  208.             u_short    x, y;    /* used for linewidth presented */
  209.         } cord;
  210.         longword    pos;    /* absolute offset    */
  211.     } offset;        /* fragment start offset    */
  212.     longword    total_len;    /* total data in this group (frame)    */
  213. } rtcp_movie_t;
  214. #define    TOTAL_RTP_MOVIE_HEADER_BYTES    \
  215.     (sizeof(rtphdr_t) + sizeof(rtcpsdeschdr_t) + sizeof(rtcp_movie_t))
  216.  
  217. /* RTP standard content encodings for audio */
  218. #define RTPCONT_PCMU        0    /* 8kHz PCM mu-law mono */
  219. #define RTPCONT_1016        1    /* 8kHz CELP (Fed Std 1016) mono */
  220. #define RTPCONT_G721        2    /* 8kHz G.721 ADPCM mono */
  221. #define RTPCONT_GSM        3    /* 8kHz GSM mono */
  222. #define RTPCONT_G723        4    /* 8kHz G.723 ADPCM mono */
  223. #define RTPCONT_DVI        5    /* 8kHz Intel DVI ADPCM mono */
  224. #define RTPCONT_L16_16        6    /* 16kHz 16-bit linear mono */
  225. #define RTPCONT_L16_44_2    7    /* 44.1kHz 16-bit linear stereo */
  226.  
  227. /* RTP standard content encodings for video */
  228. #define    RTPCONT_CUSEEME        27    /* Cornell CU-SeeMe */
  229. #define RTPCONT_NV        28    /* Xerox PARC nv */
  230. #define RTPCONT_DVC        29    /* BBN dvc */
  231. #define RTPCONT_BOLT        30    /* Bolter */
  232. #define RTPCONT_H261        31    /* CCITT H.261 */
  233.  
  234. #define    RTPCONT_MOVIE        48    /* LBL MOVIE    */
  235. #define    RTPCONT_TEST        49    /* RTP TEST MODE    */
  236.  
  237. #endif /*_rtp_h*/
  238.